//package com.klinechart.model.net;
//
//import android.content.Context;
//import android.text.TextUtils;
//
//import com.klinechart.model.entity.res.AccountInfoResult;
//import com.klinechart.model.entity.res.AccountTokenResult;
//import com.klinechart.model.entity.res.CreateSessionResult;
//import com.klinechart.model.entity.res.CreateTicketResult;
//import com.klinechart.model.entity.res.CreateTokenResult;
//import com.klinechart.model.entity.res.OrderResult;
//import com.klinechart.model.entity.res.TradePWDVerifyResult;
//import com.klinechart.model.info.LocalSp;
//import com.klinechart.model.info.UserModel;
//import com.klinechart.presenter.info.AccountInfoPresenter;
//import com.klinechart.presenter.info.AccountTokenPresenter;
//import com.klinechart.presenter.info.CreateNewOrderPresenter;
//import com.klinechart.presenter.info.CreateSessionPresenter;
//import com.klinechart.presenter.info.CreateTicketPresenter;
//import com.klinechart.presenter.info.CreateTokenPresenter;
//import com.klinechart.presenter.info.OpenOrderPresenter;
//import com.klinechart.presenter.info.TradePasswordVerifyPresenter;
//import com.klinechart.presenter.iview.IAccountInfoView;
//import com.klinechart.presenter.iview.IAccountTokenView;
//import com.klinechart.presenter.iview.ICreateSessionView;
//import com.klinechart.presenter.iview.ICreateTicketView;
//import com.klinechart.presenter.iview.ICreateTokenView;
//import com.klinechart.presenter.iview.IOpenOrderView;
//import com.klinechart.presenter.iview.IOrderResultView;
//import com.klinechart.presenter.iview.IResult;
//import com.klinechart.presenter.iview.ITradePWDVerifyView;
//import com.klinechart.util.log.LogUtil;
//
//import java.util.List;
//
//import io.reactivex.subjects.PublishSubject;
//
///**
// * 交易API
// * Created by TenFace on 2018/5/3.
// */
//
//public class TradeOrderApi implements IOpenOrderView, ITradePWDVerifyView, ICreateSessionView, ICreateTicketView, ICreateTokenView, IAccountTokenView, IOrderResultView, IAccountInfoView {
//
//    private TradePasswordVerifyPresenter tradePasswordVerifyPresenter;
//    private CreateSessionPresenter createSessionPresenter;
//    private CreateTokenPresenter createTokenPresenter;
//    private CreateTicketPresenter createTicketPresenter;
//    private AccountTokenPresenter accountTokenPresenter;
//    private CreateNewOrderPresenter createNewOrderPresenter;
//    private OpenOrderPresenter openOrderPresenter;
//    private AccountInfoPresenter accountInfoPresenter;
//    private String ssoToken;
//    private String accountId;
//    private String ticket;
//    private String session;
//    private String orderTradeToken;
//    private String accountTradeToken;
//    private String ssoTradeToken;
//    private static volatile TradeOrderApi instance;
//    private Context mContext;
//    private UserModel mUserModel;
//
//    private TradeOrderApi(Context context) {
//        mContext = context;
//        mUserModel = UserModel.getInstance();
//        tradePasswordVerifyPresenter = new TradePasswordVerifyPresenter(this);
//        createSessionPresenter = new CreateSessionPresenter(this);
//        createTicketPresenter = new CreateTicketPresenter(this);
//        createTokenPresenter = new CreateTokenPresenter(this);
//        accountTokenPresenter = new AccountTokenPresenter(this);
//        createNewOrderPresenter = new CreateNewOrderPresenter(this);
//        accountInfoPresenter = new AccountInfoPresenter(this);
//        openOrderPresenter = new OpenOrderPresenter(this);
//        ssoToken = LocalSp.getInstance(context).getSSOToken();
//        ssoTradeToken = LocalSp.getInstance(context).getSSOTradeToken();
//        accountTradeToken = LocalSp.getInstance(context).getAccountToken();
//        accountId = LocalSp.getInstance(context).getAccountInfoId();
//        orderTradeToken = LocalSp.getInstance(context).getOrderTradeToken();
//        session = LocalSp.getInstance(context).getOrderTradeSession();
//        ticket = LocalSp.getInstance(context).getOrderTradeTicket();
//    }
//
//
//    public static TradeOrderApi getInstance(Context context) {
//        if (instance == null) {
//            synchronized (TradeOrderApi.class) {
//                if (instance == null) {
//                    instance = new TradeOrderApi(context);
//                }
//            }
//        }
//        return instance;
//    }
//
//    public void createSSOTrderToken(String password, final IResult<String> callBack) {
//        ssoToken = LocalSp.getInstance(mContext).getSSOToken();
//        tradePasswordVerifyPresenter.verifyTradePassword(mContext, ssoToken, password);
//        mUserModel.verifyTradePassword(ssoToken, password, new HttpObserver<TradePWDVerifyResult>() {
//            @Override
//            public void onSuccess(TradePWDVerifyResult tradePWDVerifyResult) {
//                LogUtil.e("", "查询成功！");
//                if (mIView != null) {
//                    mIView.createSSOTradePWDSuccess(tradePWDVerifyResult);
//                    //存入ssoTradeToken
//                    if (!TextUtils.isEmpty(tradePWDVerifyResult.getToken())) {
//                        LocalSp.getInstance(mContext).saveSSOTradeToken(tradePWDVerifyResult.getToken());
//                        LocalSp.getInstance(mContext).saveSSOTradeExpiredTime(tradePWDVerifyResult.getExpiredTime());
//                    }
//                }
//            }
//
//            @Override
//            public void onError(int errType, String errMessage) {
//                LogUtil.e("", "失败码：" + errType + "》》信息：" + errMessage);
//                if (mIView != null) {
//                    mIView.createSSOTradePWDFail(errType, errMessage);
//                }
//            }
//        },null);
//    }
//
//    @Override
//    public void getAccountInfoSuccess(AccountInfoResult accountInfoResult) {
//
//    }
//
//    @Override
//    public void getAccountInfoFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void createSSOTradePWDSuccess(TradePWDVerifyResult tradePWDVerifyResult) {
//
//    }
//
//    @Override
//    public void createSSOTradePWDFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void createAccountTokenSuccess(AccountTokenResult accountTokenResult) {
//
//    }
//
//    @Override
//    public void createAccountTokenFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void createTicketSuccess(CreateTicketResult createTicketResult) {
//
//    }
//
//    @Override
//    public void createTicketFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void orderOpenSuccess(List<OrderResult> orderResultList) {
//
//    }
//
//    @Override
//    public void orderOpenFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void createTokenSuccess(CreateTokenResult createTokenResult) {
//
//    }
//
//    @Override
//    public void createTokenFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void orderSuccess(OrderResult orderResult) {
//
//    }
//
//    @Override
//    public void orderFail(int status, String desc) {
//
//    }
//
//    @Override
//    public void createSessionSuccess(CreateSessionResult createSessionResult) {
//
//    }
//
//    @Override
//    public void createSessionFail(int status, String desc) {
//
//    }
//
//    @Override
//    public PublishSubject<LifeCycleEvent> getLifeSubject() {
//        return null;
//    }
//}
